package com.easygoods.dao;


import com.easygoods.base.BaseDao;
import com.easygoods.entity.MemberCoupon;
import com.easygoods.enums.CouponState;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author zhq
 * @date 2019/1/16
 */
@Repository
public interface MemberCouponDao extends BaseDao<MemberCoupon> {
    List<MemberCoupon> getMemberCouponList(@Param("memberId") String memberId, @Param("couponState") String couponState);

    //指定用户 normal 状态代金券合计
    BigDecimal sumNormalCoupon(@Param("memberId") String memberId, @Param("state") CouponState state);

    //指定用户 normal 状态代金券合计
    default BigDecimal sumNormalCoupon(String memberId) {
        return this.sumNormalCoupon(memberId, CouponState.Normal);
    }

    //获取过期的代金券id列表
    List<String> getExpiredCouponList(@Param("memberId") String memberId, @Param("state") CouponState state);

    //获取过期的代金券id列表
    default List<String> getExpiredCouponList(String memberId) {
        return this.getExpiredCouponList(memberId, CouponState.Normal);
    }

}
